//
//  SingleDetailsBigCollectionViewCell.m
//  项目A --半糖
//
//  Created by romana on 16/5/26.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "SingleDetailsBigCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@implementation SingleDetailsBigCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
       
        [self doSomething];
    }

    return self;
}

-(void)doSomething{

    self.bigImageV = [[UIImageView alloc] init];
    self.bigImageV.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.bigImageV];
    
    self.titleLabel = [UILabel new];
    self.titleLabel.backgroundColor = [UIColor whiteColor];
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.titleLabel];
    
    self.descLabel = [UILabel new];
    self.descLabel.backgroundColor = [UIColor whiteColor];
    self.descLabel.font = [UIFont systemFontOfSize:12];

    [self.contentView addSubview:self.descLabel];
    
    self.priceLabel = [UILabel new];
    self.priceLabel.backgroundColor = [UIColor whiteColor];
    self.priceLabel.font = [UIFont systemFontOfSize:12];

    [self.contentView addSubview:self.priceLabel];
    
    self.likesLabel = [UILabel new];
    self.likesLabel.backgroundColor = [UIColor whiteColor];
    self.likesLabel.font = [UIFont systemFontOfSize:12];

    [self.contentView addSubview:self.likesLabel];
    

}

-(void)layoutSubviews{

    self.bigImageV.frame = CGRectMake(0, 0, self.frame.size.width, 190);
    self.titleLabel.frame = CGRectMake(10 , 190, self.frame.size.width - 10, 20);
    self.descLabel.frame = CGRectMake(10, 210, self.frame.size.width - 10, 20);
    self.priceLabel.frame = CGRectMake(10, 230, self.frame.size.width / 3, 20);
    self.likesLabel.frame = CGRectMake(self.frame.size.width / 3 * 2, 230, self.frame.size.width / 3, 20);

}

-(void)setModel:(SingleDetailsBigCollectionModel *)model{

    _model = model;
    
    [self.bigImageV sd_setImageWithURL:[NSURL URLWithString:_model.pic]];
    self.titleLabel.text = _model.title;
    self.descLabel.text = _model.desc;
    self.priceLabel.text = _model.price;
    self.likesLabel.text = _model.likes;



}


@end
